import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const routeMap = [
  {
    path: "/",
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('@/pages/index.vue'),
    meta: { title: '表单设计器' }
  },
  {
    path: '/design/:id',
    name: 'design',
    component: () => import('@/pages/design.vue'),
    meta: { title: '表单设计器' }
  },
  {
    path: '/render/:id',
    name: 'render',
    component: () => import('@/pages/render.vue'),
    meta: { title: '表单填写' }
  },
  {
    path: '/preview/:id',
    name: 'preview',
    component: () => import('@/pages/preview.vue'),
    meta: { title: '表单渲染' }
  },

]

const router = new Router({
  // mode: 'history', // 需要服务支持
  base: './',
  routes: [...routeMap]
})

export default router